<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="../../css/mui.css"/>
		<link href="../../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="../../css/general.css"/>
		<style type="text/css">
			.main{
				width:100%;
				margin: 0.5em 0;
				background-color: white;
			}
			.flex1{
				display: flex;
				justify-content: space-between;
				align-items: center;
				width: 100%;
			}
			.flex1>div{
				padding: 0.5em;
			}
			.padding05{
				
			}
			.flex2{
				display: flex;
				align-items: center;
				justify-content: center;
				flex-direction: column;
				padding: 0.5em;
			}
			.color{
				color: orange;
			}
			.max-widht{
				display: block;
				max-width: 70%;
				word-break: break-word;
			}
			*{
				font-size: 0.95em;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav hbg">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left colorw"></a>
		    <h1 class="mui-title">消费历史</h1>
		</header>
		<div class="mui-content" id="orderlist">
			<!--
            	作者：592176224@qq.com
            	时间：2019-03-19
            	描述：
		    <div class="main flex1 ">
		    	<div class="">
		    		2018-12
		    	</div>
		    	<div class="">
		    		消费总金额：20000元
		    	</div>
		    </div>
            -->
		    	
		    
	           
		            
		           
		  
		    
		    
		    
		</div>
		<script src="../../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/mui.min.js"></script>
		<script src="../../js/req.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/muishow.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			var mid = 0,	//会员id
			page = 1;		//分页
			window.onload = function(){
				mid = getrequest().mid;
				
				getorder_list()
			}
			
			function getorder_list(){
				var data = {
					url:"/api/member/list_order",
					data:{
						access_token:acctoken(),
						member_id:mid,
						page:page
					}
				}
				ajax(data,function(res){
					console.log("会员历史消费",res);
					try{
						setorder_list(res.data.order.data);
					}catch(e){
						//TODO handle the exception
						g("orderlist").innerHTML = '<div class="nolistdiv">暂无数据</div>';
					}
				})
				
			}
			
			function setorder_list(list){
				var str = '';
				if(list&&list.length > 0){
				list.forEach(function(item,index){
					//console.log(item)
					str += '<ul class="mui-table-view" ><li class="mui-table-view-cell">'+
							'<div class="flex1"><span id="">'+
				    		item.order_name+
				    		'</span><span id="" class="color"></span>'+
				    		'</div><div class="flex1"><span id="">消费时间：'+
				    		item.createtime+
				    		'</span><span id="">获得积分：'+
				    		item.give_score+
				    		'</span></div><div class="flex1"><span id="">消费单号：'+
				    		item.order_number+
				    		'</span><span id="" class="color">'+
				    		item.pay_sort.name+
				    		'</span></div><div class="flex1">'+
				    		'<span id="" class="max-widht">备注：'+
				    		item.remark+
				    		'</span></div>'+
				    		'<div class="flex1">'+
				    		'<span id="">店铺：'+
				    		item.store.store_name+
				    		'</span></div></li></ul>';
					})
				}else{
					str += '<div class="nolistdiv">暂无数据</div>';
				}
				g("orderlist").innerHTML = str;
			}
		</script>
	</body>

</html>